package net.zoneland.zrdp.common.core.page;

import lombok.Data;

import java.io.Serializable;
import java.util.List;


/**
 * 分页处理对象.
 * @author Pbody
 */
@Data
public class Pager<T> implements Serializable {

    private static final long serialVersionUID = 7413934001843897320L;
    /**
     * 总记录数.
     **/
    private Long totalCount;
    /**
     * 每页记录数.
     **/
    private Long pageSize;
    /**
     * 总页数.
     **/
    private Long totalPage;
    /**
     * 当前页数.
     **/
    private Long currPage;
    /**
     * 列表数据.
     **/
    private List<T> list;

    public Pager() {
    }

    /**
     * 分页.
     * @param list        列表数据
     * @param totalCount  总记录数
     * @param pageSize    每页记录数
     * @param currPage    当前页数
     */
    public Pager(final List<T> list, final Long totalCount, final Long pageSize, final Long currPage) {
        this.list = list;
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.currPage = currPage;
        this.totalPage = Math.abs(totalCount / pageSize);
    }

}
